home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / p4 / p4-1_2c.lha / p4-1.2c / messages / vec_slave.c < prev   
C/C++ Source or Header  |  1993-05-24  |  553b  |  36 lines

  1. #include "p4.h"
  2. #include "sr_user.h"
  3.     
  4. slave()    
  5. {
  6.     int nslaves;
  7.     int done;
  8.     int type, from, size;
  9.     int next;
  10.     int my_id;
  11.     char *incoming;
  12.     
  13.     my_id = p4_get_my_id();
  14.     nslaves = p4_num_total_ids() - 1;
  15.     
  16.     if (my_id == nslaves)
  17.         next = 0;
  18.     else
  19.     next = my_id + 1;
  20.     
  21.     done = FALSE;
  22.     while (!done)
  23.     {
  24.     type = -1;
  25.     from = -1;
  26.     incoming = NULL;
  27.     p4_recv(&type,&from, &incoming, &size);
  28.     p4_sendx(type, next, incoming, size, P4INT);
  29.     if (type == END)
  30.         done = TRUE;
  31.     p4_msg_free(incoming);
  32.     }
  33. }
  34.  
  35.  
  36.